/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.guet.careapp.pojo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author LXM
 */
@Entity
@Table(name = "t_user_under_guardians_info")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TUserUnderGuardiansInfo.findAll", query = "SELECT t FROM TUserUnderGuardiansInfo t"),
    @NamedQuery(name = "TUserUnderGuardiansInfo.findByUgId", query = "SELECT t FROM TUserUnderGuardiansInfo t WHERE t.ugId = :ugId"),
    @NamedQuery(name = "TUserUnderGuardiansInfo.findByUId", query = "SELECT t FROM TUserUnderGuardiansInfo t WHERE t.uId = :uId"),
    @NamedQuery(name = "TUserUnderGuardiansInfo.findByAge", query = "SELECT t FROM TUserUnderGuardiansInfo t WHERE t.age = :age"),
    @NamedQuery(name = "TUserUnderGuardiansInfo.findByBodycondition", query = "SELECT t FROM TUserUnderGuardiansInfo t WHERE t.bodycondition = :bodycondition"),
    @NamedQuery(name = "TUserUnderGuardiansInfo.findByDiseaseName", query = "SELECT t FROM TUserUnderGuardiansInfo t WHERE t.diseaseName = :diseaseName"),
    @NamedQuery(name = "TUserUnderGuardiansInfo.findByRemark", query = "SELECT t FROM TUserUnderGuardiansInfo t WHERE t.remark = :remark")})
public class TUserUnderGuardiansInfo implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "ug_id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer ugId;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "u_id")
    private Integer uId;
    @Column(name = "age")
    private Integer age;
    @Size(max = 255)
    @Column(name = "bodycondition")
    private String bodycondition;
    @Size(max = 255)
    @Column(name = "disease_name")
    private String diseaseName;
    @Size(max = 255)
    @Column(name = "remark")
    private String remark;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ugInfoId")
    private Collection<TServiceMessageInfo> tServiceMessageInfoCollection;
    @JoinColumn(name = "u_id", referencedColumnName = "u_id", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private TUserInfo tUserInfo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ugInfoId")
    private Collection<TUserRelation> tUserRelationCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ugInfoId")
    private Collection<TInstruction> tInstructionCollection;

    public TUserUnderGuardiansInfo() {
    }

    public TUserUnderGuardiansInfo(Integer uId) {
        this.uId = uId;
    }

    public Integer getUgId() {
        return ugId;
    }

    public void setUgId(Integer ugId) {
        this.ugId = ugId;
    }

    public Integer getUId() {
        return uId;
    }

    public void setUId(Integer uId) {
        this.uId = uId;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getBodycondition() {
        return bodycondition;
    }

    public void setBodycondition(String bodycondition) {
        this.bodycondition = bodycondition;
    }

    public String getDiseaseName() {
        return diseaseName;
    }

    public void setDiseaseName(String diseaseName) {
        this.diseaseName = diseaseName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @XmlTransient
    public Collection<TServiceMessageInfo> getTServiceMessageInfoCollection() {
        return tServiceMessageInfoCollection;
    }

    public void setTServiceMessageInfoCollection(Collection<TServiceMessageInfo> tServiceMessageInfoCollection) {
        this.tServiceMessageInfoCollection = tServiceMessageInfoCollection;
    }

    public TUserInfo getTUserInfo() {
        return tUserInfo;
    }

    public void setTUserInfo(TUserInfo tUserInfo) {
        this.tUserInfo = tUserInfo;
    }

    @XmlTransient
    public Collection<TUserRelation> getTUserRelationCollection() {
        return tUserRelationCollection;
    }

    public void setTUserRelationCollection(Collection<TUserRelation> tUserRelationCollection) {
        this.tUserRelationCollection = tUserRelationCollection;
    }

    @XmlTransient
    public Collection<TInstruction> getTInstructionCollection() {
        return tInstructionCollection;
    }

    public void setTInstructionCollection(Collection<TInstruction> tInstructionCollection) {
        this.tInstructionCollection = tInstructionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (uId != null ? uId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TUserUnderGuardiansInfo)) {
            return false;
        }
        TUserUnderGuardiansInfo other = (TUserUnderGuardiansInfo) object;
        if ((this.uId == null && other.uId != null) || (this.uId != null && !this.uId.equals(other.uId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojo.TUserUnderGuardiansInfo[ uId=" + uId + " ]";
    }
    
}
